package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.DeleteUnpaidBean;
import com.lwj.liwanjia.impl.DeleteUnpaidView;
import com.lwj.liwanjia.model.DeleteUnpaidModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/20.
 */

public class DeleteUnpaidPresenter {
    private DeleteUnpaidModel deleteUnpaidModel;
    private DeleteUnpaidView deleteUnpaidView;

    public DeleteUnpaidPresenter(DeleteUnpaidView deleteUnpaidView) {
        this.deleteUnpaidView = deleteUnpaidView;
        deleteUnpaidModel = new DeleteUnpaidModel();
    }

    public void deleteUnpaidIndent(String token, String tradeId) {
        if (deleteUnpaidView != null) {
            deleteUnpaidModel.deleteUnpaidIndent(token, tradeId, new Subscriber<DeleteUnpaidBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    deleteUnpaidView.showError((Exception) e);
                }

                @Override
                public void onNext(DeleteUnpaidBean deleteUnpaidBean) {
                    deleteUnpaidView.deleteUnpaidIndent(deleteUnpaidBean);
                }
            });
        }
    }
}
